package com.ruoyi.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.domain.Courses;
import com.ruoyi.system.mapper.MyCoursesMapper;
import com.ruoyi.system.service.IMyCoursesService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 【请填写功能名称】Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-04-02
 */

@Service("myCoursesService")
public class MyCoursesServiceImpl extends ServiceImpl<MyCoursesMapper, Courses> implements IMyCoursesService
{
    @Resource
    private MyCoursesMapper myCoursesMapper;

    @Override
    public int insertCoursesAndReturnId(Courses courses) {

        myCoursesMapper.insert(courses);
        return 0;

//        Courses coursesData=myCoursesMapper.selectOne(new QueryWrapper<Courses>().eq("coursename", courses.getCoursename()));
//        if(coursesData==null){ //为空才插入新用户
//            myCoursesMapper.insert(courses);
//            return Integer.valueOf(courses.getId().toString());
//        }
//        return Integer.valueOf(coursesData.getId().toString());
    }

}
